<?php
require __DIR__ . '/../vendor/autoload.php';

use ChatX\Storage\StorageFactory;

// 使用MinIO
$minioConfig = [
    'endpoint' => 'https://image.chat-x.cyou',
    'access_key' => 'px55B2wJ0cAEBmOrRyid',
    'secret_key' => 'tfe7icOOEhqT2rvMYoDNoAg53gzC48OLYEnhMbtf',
    'region' => 'liu-cn-west',
    'verify_ssl' => false,
    // 添加以下参数禁用警告
    'suppress_php_deprecation_warning' => true
];

$minio = \ChatX\Storage\StorageFactory::create('minio', $minioConfig);
$uploadResult = $minio->upload('demo', 'example.jpg', 'example.jpg');
if ($uploadResult) {
    echo "MinIO 上传成功: " . $uploadResult['object_key'] . "\n";
    echo "访问URL: " . $minio->getUrl('demo', 'example.jpg') . "\n";
}

//// 使用阿里云OSS
//$ossConfig = [
//    'access_key' => 'LTAI5tPjLdt6NvMLcBgub7oH',
//    'secret_key' => 'fUGKc0T7KsM2HBbdjjivzEpDjrtcUG',
//    'endpoint' => 'oss-cn-hangzhou.aliyuncs.com'
//];
//
//$oss = StorageFactory::create('oss', $ossConfig);
//$objects = $oss->listObjects('lckj-zh');
//if ($objects) {
//    echo "阿里云OSS对象列表:\n";
//    print_r($objects);
//}

//// 使用腾讯云COS
//$tencentConfig = [
//    'secret_id' => 'tencent_secret_id',
//    'secret_key' => 'tencent_secret_key',
//    'region' => 'ap-beijing'
//];
//
//$tencent = StorageFactory::create('tencent', $tencentConfig);
//$fileInfo = $tencent->getInfo('my-tencent-bucket', 'example.jpg');
//if ($fileInfo) {
//    echo "腾讯云COS文件信息:\n";
//    print_r($fileInfo);
//}